#include "Rectangle.h"

Rectangle::Rectangle() {
  mWidth = 1;
  mHeight = 1;
}

Rectangle::Rectangle(double aWidth, double aHeight) {
  this->mWidth = aWidth;
  this->mHeight = aHeight;
}

double Rectangle::getWidth() {
  return mWidth;
}

void Rectangle::setWidth(double aWidth) {
  this->mWidth = (aWidth >= 0) ? aWidth : 0;
}

double Rectangle::getHeight() {
  return mHeight;
}

void Rectangle::setHeight(double aHeight) {
  this->mHeight = (aHeight >= 0) ? aHeight : 0;
}

double Rectangle::getArea() {
  return mWidth * mHeight;
}

double Rectangle::getPerimeter() {
  return 2 * (mWidth + mHeight);
}
